<template>
	<view class="item">
		<img :src="info.files.fullurl" alt="">
		<view class="item__btn" @click="use(info.id)">
			使用
		</view>
		<view class="item__closed" @click="dele">
			<!-- <icon type="clear" size="16" /> -->
		</view>
	</view>
</template>

<script>
	import {
		meetSignatureDel,
		meetSignAdd
	} from "@/api/autograph.js"
	export default {
		props: {
			info: {
				type: Object
			},
			init: {
				type: Function
			},
			meet_id:{
				type:String|Number
			},
      type_sigin:{
			  type:String|Number
        //判断 2 是手写签到页面   1是从扫码签到页面跳转过来的
      }
		},
		methods: {
			async dele() {
				const res = await meetSignatureDel({
					id: this.info.id
				});
				uni.showToast({
					icon:"none",
					title:res.msg
				})
				if(res.code==1){
					this.init()
				}
				console.log(res)
			},
			async use(id){
			  if(this.type_sigin=='1'){
          uni.navigateTo({
            url: '/pages/signin/signin?meet_id=' + this.meet_id+'&write_name_id='+id
          });
        }
			  if(this.type_sigin=='2'){
          // console.log(id+'XXXXXXXXX');
          const res= await meetSignAdd({
            meet_id:this.meet_id,
            qiming_id:id,
            sign_way:1
          });
          uni.showToast({
            title: res.msg,
            icon: 'none',
            duration: 1000
          });
          setTimeout(()=>{
            uni.navigateTo({
              url: '/pages/tabbar-1-detial/meetingDetails/meetingDetails?id=' + this.meet_id
            });
          },1000)
          /* if(res.code==1) {
            uni.navigateBack()
          } */
        }
			}
		}
	}
</script>

<style lang="less" scoped>
	.item {
		position: relative;
		color: #4871C0;
		width: 208rpx;
		margin-right: 32rpx;

		img {
			width: 208rpx;
			height: 208rpx;
		}

		&__btn {
			// margin-top: 22rpx;
			border-radius: 8rpx 8rpx 8rpx 8rpx;
			opacity: 1;
			border: 1px solid #4871C0;
			width: 208rpx;
			text-align: center;
			line-height: 68rpx;
			height: 68rpx;
			font-size: 28rpx;
		}

		&__closed {
			position: absolute;
			right: -6rpx;
			top: -20rpx;
			width: 32rpx;
		height: 32rpx;
		background-size: cover;
			background-image: url('~@/static/img/canvas/Subtract.png');
		}
	}
</style>
